#include "widget.h"
#include "ui_widget.h"

Widget::Widget(QWidget *parent)
    : QWidget(parent)
    , ui(new Ui::Widget)
{
    ui->setupUi(this);
}

Widget::~Widget()
{
    delete ui;
}


void Widget::on_pushButton_accept_clicked()
{
    //按下接收按钮，修改label
    ui->label->setText("I expected that.");
    //拒绝按钮设置为不可用
    ui->pushButton_reject->setEnabled(false);
}


void Widget::on_pushButton_reject_clicked()
{
    int width = this->geometry().width();//找到主窗口的宽度和高度
    int height = this->geometry().height();
    int x = rand() % width;//在主窗口的宽度和高度之间的值求一个随机值
    int y = rand() % height;
    ui->pushButton_reject->move(x,y);//设置新的位置
}
